package com.hs.egova.util;

/**
 * 根据文件魔数判断文件实际类型，防止修改后缀误判
 * @author husheng
 * @version v1.0
 * @date 2021/7/20 10:37
 * @email husheng@egova.com.cn
 */
public enum FileType {
    //jpg,jpeg
    JPEG("JPEG", "FFD8FF"),

    /**
     * png
     */
    PNG("PNG", "89504E47"),

    /**
     * xml
     */
    XML("XML","3C3F786D6C"),

    /**
     * HTML
     */
    HTML("HTML", "68746D6C3E"),
    /**
     * PDF
     */
    PDF("PDF", "255044462D312E"),
    /**
     * ZIP
     */
    ZIP("ZIP", "504B0304"),
    /**
     * rar
     */
    RAR("RAR", "52617221"),;

    /**
     * 文件类型
     */
    private String type;
    /**
     * 文件魔数
     */
    private String value;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    FileType(String type, String value) {
        this.type = type;
        this.value = value;
    }
}
